package com.lm.atomikos.controller;

import com.lm.atomikos.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/business")
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    @GetMapping("/create")
    public String create(@RequestParam String productId, @RequestParam int count) {
        try {
            businessService.createOrder(productId, count);
            return "创建成功";
        } catch (Exception e) {
            return "创建失败：" + e.getMessage();
        }
    }
}

